package com.zxm.ssm.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author Riskre
 * 配置类获取配置文件里面OSS的信息
 */
@Component
public class ConstantConfig implements InitializingBean {
    @Value("oss-cn-beijing.aliyuncs.com")
    private String endpoint;
    @Value("LTAI4G8jKQ44KFGwaLPY9EQp")
    private String accessKeyId;
    @Value("uZL2dzuaNaGwpN4KmVVnUM85H5xD32")
    private String accessKeySecret;
    @Value("riskre-store")
    private String bucketName;
    //文件存储目录
    @Value("userImg/")
    private String filedir;

    public static String ALIYUN_END_POINT;
    public static String ALIYUN_ACCESS_KEY_ID;
    public static String ALIYUN_ACCESS_KEY_SECRET;
    public static String ALIYUN_BUCKET_NAME1;
    public static String ALIYUN_FILE_HOST;

    @Override
    public void afterPropertiesSet() throws Exception {
        ALIYUN_END_POINT = endpoint;
        ALIYUN_ACCESS_KEY_ID = accessKeyId;
        ALIYUN_ACCESS_KEY_SECRET = accessKeySecret;
        ALIYUN_FILE_HOST = filedir;
        ALIYUN_BUCKET_NAME1 = bucketName;
    }

}
